/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cx1.model.utils;

import java.util.Comparator;
import org.cx1.model.Listing;

/**
 *
 * @author ECH
 */
public class ListingComparator implements Comparator<Listing> {
    @Override
    public int compare(Listing o1, Listing o2) {        
        
        if (o1.isPenalized() && o2.isPenalized()) {
            return 0;
        }
        else if (o1.isPenalized()) {
            return 1;
        }
        else if (o2.isPenalized()) {
            return -1;
        }
        return (o1.getDateCreated().compareTo(o2.getDateCreated())*-1);
    }
}
